<template>
  <div class="block" style="margin-top: 50px; margin-bottom: 50px; ">

    <el-carousel :height="bannerHeight+'px'" trigger="click" style="border-radius: 15px" class="widget-1" >
<!--      <el-carousel-item v-for="item in 4" :key="item">-->

<!--        <h3 class="small">{{ item }}</h3>-->
<!--      </el-carousel-item>-->
      <el-carousel-item>
        <img ref="bannerHeight"  src="images/banner.svg" style="width: 100%; "  @load="imgLoad">


      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  name: "Banner",
  data(){
    return{
      screenwidth: "300px",
      bannerHeight:"",
    }
  },
  methods:{
    imgLoad(){
      this.$nextTick(()=>{
        console.log(this.$refs)
        let ref = this.$refs
        this.bannerHeight=ref.bannerHeight&&ref.bannerHeight.height?ref.bannerHeight.height:'';
      })
    }
  },
  mounted() {
    this.imgLoad();
    window.addEventListener('resize',() => {
      this.imgLoad();
    },false)

  }
}
</script>

<style scoped>
.el-carousel__item h3 {
  color: #475669;
  font-size: 14px;
  opacity: 0.75;
  line-height: 150px;
  margin: 0;
}

.el-carousel__item:nth-child(2n) {
  background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n+1) {
  background-color: #d3dce6;
}
</style>